<?php $this->load->view('common/head');?>
<form class="form-inline" name="add" id="add" action="<?php echo $this->input->server('REQUEST_URI'); ?>" method="post">
	<input type="hidden" name="id" id="id" value="<?=$auditData['id']?>">
	<table class="table table-bordered">
		<thead>
			<tr>
        		<th class="bg-primary" colspan="2">补报基本信息</th>
        	</tr>
    	</thead>
    <tbody>
    	<tr>
    		<td class="col-md-1">年份：</td>
    		<td>
    			<div class="form-group">
          <?php if (isset($auditData['year']) && $auditData['year']) {
            echo $auditData['year'];
            ?>
          <input type="hidden" name="year" id="year" value="<?=$auditData['year']?>">
          <?php }else{ ?>
    			<select class="form-control" required style="width: 150px;" id="year" name="year">
			      <option value="">请选择</option>
				  </select>
          <?php } ?>
				</div>
    		</td>
    	</tr>
    	<tr>
    		<td class="col-md-1">双月：</td>
    		<td>
    			<div class="form-group">
          <?php if (isset($auditData['timeUnit']) && $auditData['timeUnit']) {
            echo $auditData['timeUnitStr'];
            ?>
          <input type="hidden" name="timeUnit" id="timeUnit" value="<?=$auditData['timeUnit']?>">
          <?php }else{ ?>
    			<select class="form-control" required style="width: 150px;" id="timeUnit" name="timeUnit">
			      <option value="">请选择</option>
  				</select>
          <?php } ?>
				</div>
    		</td>
    	</tr>
    	<tr>
    		<td class="col-md-1">开始时间：</td>
    		<td>
    			<div class="form-group">
    			<input type="text" class="form-control" style="width: 200px;" required onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'endTime\')}'})" name="startTime" id="startTime" value="<?php echo $auditData['startTimeStr'] ?>" placeholder="开始时间">
    			</div>
    		</td>
    	</tr>
    	<tr>
    		<td class="col-md-1">结束时间：</td>
    		<td>
    			<div class="form-group">
    			<input type="text" class="form-control" style="width: 200px;" required onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'startTime\')}'})" name="endTime" id="endTime" value="<?php echo $auditData['endTimeStr'] ?>" placeholder="结束时间">
    			</div>
    		</td>
    	</tr>
    	<tr>
    		<td align="center" colspan="3">
    			<button type="submit" class="btn btn-default btn-primary">保存</button>
  				<button type="button" onclick="closeWindow()" class="btn btn-default btn-primary">取消</button>
    		</td>
    	</tr>
    </tbody>
    </table>
</form>
<script type="text/javascript">
	$(function(){
		//Init Validation
  		initValidation();
  		loadYearList('year',<?=$auditData['year'] ? $auditData['year'] : 2015?>);
	    loadTimeUnitList('timeUnit',<?=$auditData['year'] ? $auditData['year'] : 2015?>,<?=$auditData['timeUnit'] ? $auditData['timeUnit'] : 2015?>);
	});
/**
 * 重启验证
 * @return {[type]} [description]
 */
function initValidation() {
  $('form[name="add"]').find("input,select,textarea").jqBootstrapValidation("destroy");
  $('form[name="add"]').find("input,select,textarea").not("[type=submit]").jqBootstrapValidation({
    preventSubmit:false,
    submitSuccess: function (form, event) {
         event.preventDefault();
         $("#selectedStoreList option").attr("selected", true);
         ajaxFormSubmit('add');
     },
     submitError: function (form, event, errors) {
       event.preventDefault();
     }
  });
}
</script>
<?php $this->load->view('common/foot');?>